<template>
	<div>
		<div class="layout-breadcrumb">
			<Breadcrumb>
			    <BreadcrumbItem href="/">首页</BreadcrumbItem>
			    <BreadcrumbItem href="">用户中心</BreadcrumbItem>
			    <BreadcrumbItem href="/person/person">用户列表</BreadcrumbItem>
			</Breadcrumb>
		</div>
		<div class="layout-content">
		    <div class="layout-content-main">
		    	<Search :callback="resetTable"></Search>
		    	<BaseTable ref="table" :url="table.url" :header="table.header"></BaseTable>
		    </div>
		</div>
	</div>
</template>
<script>
import Breadcrumb from 'view-design';

import Search  from 'admin/components/person/person/search';
import BaseTable  from 'admin/components/common/table/base';

export default{
	components:{
        Breadcrumb,
        'BreadcrumbItem' : Breadcrumb.Item,
        BaseTable,
        Search,
    },
    data () {
        return {
        	table:{
        		url : '/persons/person/view/list',
        		header: []
        	}
        }
    },
    methods:{
    	resetTable(params){
    		this.$refs['table'].tableData(params);
    	}
    },
    created:function(){
    	this.table.header =  [
            {
		        title: '头像',
		        key: 'headimgurl',
		        render: (h, params) => {
		        	return h('img',{
		        		attrs :{
		        			src : params.row.headimgurl ? ('/'+params.row.headimgurl) : require('admin/assets/images/head.png'),
		        			style : 'width:100px;padding:10px;',
		        		},

		        	});
		        }
		    },
		    {
		        title: '手机号',
		        key: 'phone',
		    },
		    {
		        title: '注册时间',
		        key: 'created_at',
		    }
        ];
    },
    mounted:function(){
    	this.$store.dispatch('CHANGE_ROUTE',{name:'前台用户管理',route:'/person/person',action:1,closable:true});
    }
}
</script>